From b7794267c2350e634861d1a24ffb08a938c71b95 Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Wed, 29 Aug 2007 15:43:53 +0100 Subject: [PATCH] Skipping image name at start of command line is an architecture-specific action. Definitely not required on IA64, for now make it just x86 specific. Signed-off-by: Keir Fraser --- xen/arch/x86/setup.c | 32 +++++++++++++++++--------------- xen/common/kernel.c | 6 ------ 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 7998612653..3a6c3d7a6a 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -429,10 +429,22 @@ void init_done(void) startup_cpu_idle_loop(); } +static char * __init cmdline_cook(char *p) +{ + p = p ? : ""; + while ( *p == ' ' ) + p++; + while ( (*p != ' ') && (*p != '\0') ) + p++; + while ( *p == ' ' ) + p++; + return p; +} + void __init __start_xen(unsigned long mbi_p) { char *memmap_type = NULL; - char __cmdline[] = "", *cmdline = __cmdline, *kextra; + char *cmdline, *kextra; unsigned long _initrd_start = 0, _initrd_len = 0; unsigned int initrdidx = 1; char *_policy_start = NULL; @@ -451,8 +463,8 @@ void __init __start_xen(unsigned long mbi_p) set_intr_gate(TRAP_page_fault, &early_page_fault); /* Parse the command-line options. */ - if ( (mbi->flags & MBI_CMDLINE) && (mbi->cmdline != 0) ) - cmdline = __va(mbi->cmdline); + cmdline = cmdline_cook((mbi->flags & MBI_CMDLINE) ? + __va(mbi->cmdline) : NULL); if ( (kextra = strstr(cmdline, " -- ")) != NULL ) { /* @@ -1037,18 +1049,8 @@ void __init __start_xen(unsigned long mbi_p) { static char dom0_cmdline[MAX_GUEST_CMDLINE]; - dom0_cmdline[0] = '\0'; - - if ( cmdline != NULL ) - { - /* Skip past the image name and copy to a local buffer. */ - while ( *cmdline == ' ' ) cmdline++; - if ( (cmdline = strchr(cmdline, ' ')) != NULL ) - { - while ( *cmdline == ' ' ) cmdline++; - safe_strcpy(dom0_cmdline, cmdline); - } - } + cmdline = cmdline_cook(cmdline); + safe_strcpy(dom0_cmdline, cmdline); if ( kextra != NULL ) /* kextra always includes exactly one leading space. */ diff --git a/xen/common/kernel.c b/xen/common/kernel.c index 117690461f..9bfba6b949 100644 --- a/xen/common/kernel.c +++ b/xen/common/kernel.c @@ -34,12 +34,6 @@ void cmdline_parse(char *cmdline) if ( p == NULL ) return; - /* Skip whitespace and the image name. */ - while ( *p == ' ' ) - p++; - if ( (p = strchr(p, ' ')) == NULL ) - return; - for ( ; ; ) { /* Skip whitespace. */ -- 2.30.2